package org.jsola.hr.service;

import java.util.List;

import org.jsola.core.Page;
import org.jsola.core.service.IService;
import org.jsola.hr.dao.IAttendPlanDAO;
import org.jsola.hr.dto.attendrule.AttendRuleAddDTO;
import org.jsola.hr.dto.attendrule.AttendRuleUpdateDTO;
import org.jsola.hr.entity.AttendPlanDO;
import org.jsola.hr.query.AttendDepInfoTreeQuery;
import org.jsola.hr.query.AttendEmpInfoQuery;
import org.jsola.hr.query.AttendRuleQuery;
import org.jsola.hr.query.CheckStaffInAttendPlanQuery;
import org.jsola.hr.vo.AttendDepInfoTreeVO;
import org.jsola.hr.vo.AttendEmpInfoVO;
import org.jsola.hr.vo.AttendPlanVO;
import org.jsola.hr.vo.AttendRuleListVO;
import org.jsola.hr.vo.AttendRuleVO;
import org.jsola.hr.vo.CheckStaffInAttendPlanVO;
import org.jsola.user.core.TokenUser;

/**
 * 考勤规则
 *
 * @author wxz
 */
public interface IAttendRuleService extends IService<IAttendPlanDAO, AttendPlanDO> {

    /**
     * 保存考勤规则
     *
     * @param attendRuleAddDTO 考勤规则
     * @return 考勤规则
     */
    AttendPlanVO save(AttendRuleAddDTO attendRuleAddDTO, TokenUser tokenUser);

    /**
     * 根据ID查询考勤规则详情
     *
     * @param id
     * @param siteId
     * @return 考勤规则详情
     */
    AttendRuleVO findById(String id, String siteId);

    /**
     * 修改考勤规则
     *
     * @param AttendRuleUpdateDTO 修改考勤
     * @param tokenUser 当前用户
     * @return
     */
    int update(AttendRuleUpdateDTO AttendRuleUpdateDTO, TokenUser tokenUser);

    /**
     * 分页查询考勤规则
     *
     * @param attendRuleQuery
     * @param siteId
     * @return
     */
    Page<AttendRuleListVO> selectPage(AttendRuleQuery attendRuleQuery, String siteId);

    /**
     * 逻辑删除考勤规则
     *
     * @param id
     * @param tokenUser
     * @return
     */
    int deleteById(String id, TokenUser tokenUser);

    /**
     * 校验人员或者部门中的人员是否已经在考勤规则中
     *
     * @param checkStaffInAttendPlanQuery 校验参数
     * @param tokenUser 当前用户
     * @return true-是,false-否
     */
    CheckStaffInAttendPlanVO checkStaffInAttendPlan(CheckStaffInAttendPlanQuery checkStaffInAttendPlanQuery, TokenUser tokenUser);

    /**
     * 查询部门(树)
     * 
     * @param attendDepInfoTreeQuery 查询参数
     * @param siteId 站点ID
     * @return
     */
    List<AttendDepInfoTreeVO> selectDepInfoTree(AttendDepInfoTreeQuery attendDepInfoTreeQuery, String siteId);
    
    /**
     * 查询部门下的人员
     * 
     * @param attendEmpInfoQuery
     * @param siteId
     * @return
     */
    List<AttendEmpInfoVO> selectEmpInfo(AttendEmpInfoQuery attendEmpInfoQuery, String siteId);

    /**
     * 删除考勤规则
     *
     * @param attendPlanId 考勤规则ID
     * @param tokenUser 当前用户
     * @return
     */
    int deleteAttendPlan(String attendPlanId, TokenUser tokenUser);

    /**
     * 设置为明日生效
     *
     * @param AttendRuleUpdateDTO
     * @param tokenUser
     * @return
     */
    int setEffectiveTomorrow(AttendRuleUpdateDTO AttendRuleUpdateDTO, TokenUser tokenUser);


    /**
     * 发送消息通知
     * @param attendPlanId
     * @return
     */
    void sendNotice(String attendPlanId);


    /**
     * 定时任务发送通知
     */
    void attendPunchRemind();
}
